package com.lifa.controller;

import com.lifa.entity.Huiyuan;
import com.lifa.service.HuiYuanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/huiyuan")
@Scope("prototype")
public class HuiYuanController {

    @Autowired
    private HuiYuanService huiYuanService;

    /**
     * 查询
     * @return
     */
    @RequestMapping("/chax")
    @ResponseBody
    public List<Huiyuan> chax(){
        return huiYuanService.chax();
    }

    /**
     *模糊查询
     */
    @RequestMapping("/fenyemohchax1")
    @ResponseBody
    public Map<String,Object> fenyemohchax1(String username, int offset, int limit){
        Map<String,Object> map=new HashMap<String, Object>();
        map.put("rows",huiYuanService.fenyemohchax1(username,offset,limit));
        map.put("total",huiYuanService.mohchax1(username));
        return map;
    }
}
